﻿using System;

namespace Microsoft.CSA.FeedSync.SimpleFeedBindingsLibrarySL
{
    public class FieldValue
    {
        private string m_ID;

        private string[] m_Values;

        public FieldValue()
        {
            //  This only exists for serialization purposes
        }

        public FieldValue(string i_ID, string i_Value)
        {
            m_ID = i_ID;
            m_Values = new string[1] { i_Value };
        }

        public FieldValue(string i_ID, string[] i_Values)
        {
            m_ID = i_ID;

            if (i_Values == null)
                m_Values = new string[0];
            else
                m_Values = i_Values;
        }

        public string ID
        {
            get
            {
                return m_ID;
            }
            set
            {
                m_ID = value;
            }
        }

        public string Value
        {
            get
            {
                return ((m_Values != null) && (m_Values.Length == 1) ? m_Values[0] : null);
            }
            set
            {
                if (m_Values == null)
                    m_Values = new string[1];

                m_Values[0] = value;
            }
        }

        public string[] Values
        {
            get
            {
                return m_Values;
            }
            set
            {
                m_Values = value;
            }
        }

        public override string ToString()
        {
            return m_ID;
        }
    }
}
